package tp.pr1;

public enum Direction {EAST,NORTH,SOUTH,UNKNOWN,WEST;

public static Direction rotate(Direction direction,Rotation rotation)
{
  if(rotation==Rotation.RIGHT)
   {
	 switch(direction)
	 {
	  case NORTH:return Direction.EAST;
	  case EAST: return Direction.SOUTH;
	  case SOUTH:return Direction.WEST;
	  case WEST: return Direction.NORTH;
	  default: return Direction.UNKNOWN;
	 }
   }
  else if(rotation==Rotation.LEFT)
  {
	 switch(direction)
	 {
	  case NORTH: return Direction.WEST;
	  case WEST: return Direction.SOUTH;
	  case SOUTH: return Direction.EAST;
	  case EAST: return Direction.NORTH;
	  default: return Direction.UNKNOWN;
     }
  } 
  else return Direction.UNKNOWN;
}	

public static Direction reverseDirection(Direction direction)
{
 switch(direction)
 	{
 		case NORTH: return Direction.SOUTH;
 		case SOUTH: return Direction.NORTH;
 		case WEST:  return Direction.EAST;
 		case EAST:  return Direction.WEST;
 		default: return Direction.UNKNOWN;
 	}
}
}
